附录 C 腾讯连连开发说明 ================================ 1、测试用三元组申请 ######################## | 下载并打开腾讯云平台 https://console.cloud.tencent.com/iotexplorer,登录账号。 | 打开公共实例,如下附图3.1所示。 .. figure:: ../image/腾讯连连开发说明/图片1.png :width: 800 px :align: center 附图3.1 新建一个项目后进入项目页面新建一个产品,产品品类自行设置,如下附图3.2所示。 .. figure:: ../image/腾讯连连开发说明/图片2.png :width: 800 px :align: center 附图3.2 进入产品界面,设备开发界面选择基于标准蓝牙协议开发,如下附图3.3所示。 .. figure:: ../image/腾讯连连开发说明/图片3.png :width: 800 px :align: center 附图3.3 交互开发根据需要自行设置,如下附图3.4所示。 .. figure:: ../image/腾讯连连开发说明/图片4.png :width: 800 px :align: center 附图3.4 进入设备调试界面新建一个设备,点击设备名称进入设备信息界面,如下附图3.5所示。 .. figure:: ../image/腾讯连连开发说明/图片5.png :width: 800 px :align: center 附图3.5 该界面的设备名称,设备密钥和产品ID即为该设备的三元组。 2、腾讯连连程序开发说明 ######################### 1)应用实例生成 | 进入产品的数据模版界面,根据需要增删功能后点击查看JSON,将JSON文件下载下来,如附图3.6--附图3.7所示。 .. figure:: ../image/腾讯连连开发说明/图片6.png :width: 800 px :align: center 附图3.6 .. figure:: ../image/腾讯连连开发说明/图片7.png :width: 800 px :align: center 附图3.7 根据json转换文档说明(script \ json \ readme.md)用interpret_dt_ble.py文件将json文件转换为应用代码ble_qiot_template.c和ble_qiot_template.h。 2)应用开发 | 将这两个文件替换掉SDK的app/common/third_party_profile/Tecent_LL/include下的ble_qiot_template.h和app/common/third_party_profile/Tecent_LL/lib下的ble_qiot_template.c文件。 | ble_qiot_template.c是根据控制台所添加的功能转换生成的C模版文件,例如本文档实例生成的JSON转换的C模版文件代码,如下附图3.8所示: .. figure:: ../image/腾讯连连开发说明/图片8.png :width: 800 px :align: center 附图3.8 该模版所对应的是灯的开关功能和颜色功能。你只需在ble_property_power_switch_set函数中实现灯开关控制,在ble_property_power_switch_get函数中实现灯状态获取,ble_property_color_set函数中实现灯的颜色设置,在ble_property_color_get函数中实现灯的颜色获取即可。 功能实现实例,如下附图3.9所示: .. figure:: ../image/腾讯连连开发说明/图片9.png :width: 800 px :align: center 附图3.9 3)SDK配置 | 打开 ``earphone/include/app_config.h`` 文件,将#define CONFIG_APP_BT_ENABLE这个宏打开,同时将LL_SYNC_EN配置为1,如下附图3.10所示: .. figure:: ../image/腾讯连连开发说明/图片10.png :width: 800 px :align: center 附图3.10 进入腾讯物联网平台,点击固件升级,进入该页面后点击添加固件,如下附图3.11所示。 .. figure:: ../image/腾讯连连开发说明/图片11.png :width: 800 px :align: center 附图3.11 填写好固件名称,在所属产品那选择该固件所对应的产品,填写好固件版本号,该版本号需要与上述程序中的 ``ble_qiot_config.h`` 里的BLE_QIOT_USER_DEVELOPER_VERSION版本号对应,如下附图3.12所示。 .. figure:: ../image/腾讯连连开发说明/图片12.png :width: 800 px :align: center 附图3.12 点击选择固件,OTA固件文件为db_update_data.bin,该文件的路径在: ``CPU\BR30\tools\db_update_data.bin`` ,上传成功后点击保存即完成了OTA文件升级。